import java.util.concurrent.LinkedBlockingQueue;

public class Worker extends Thread {

	private LinkedBlockingQueue<String> lista;
	private boolean running = true;

	public Worker() {
		lista = new LinkedBlockingQueue<String>();
	}

	public void run() {
		while (running) {
			String l = null;
			try {

				if (running == false && lista.isEmpty()) {
					return;
				}
				l = lista.take();

			} catch (InterruptedException e) {

			}

			if (l != null) {
				System.out.println("trabajando con " + l);
			}
		}
	}

	public void notifi() {
		lista.notify();
	}

	public void addData(String dato) {
		lista.add(dato);

	}

	public void setRunning(boolean running) {
		this.running = running;
	}
}
